package com.zhss.eshop.wms.mapper;

import com.zhss.eshop.wms.domain.model.WmsPurchaseInputOrderItem;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WmsPurchaseInputOrderItemMapper {
    int deleteByPrimaryKey(Long id);

    int insertSelective(WmsPurchaseInputOrderItem record);

    WmsPurchaseInputOrderItem selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(WmsPurchaseInputOrderItem record);
    /**
     * 根据采购入库单id查询采购入库单条目
     * @param purchaseInputOrderId 采购入库单id
     * @return 采购入库单条目
     */
    @Select("SELECT "
            + "id,"
            + "purchase_input_order_id,"
            + "goods_sku_id,"
            + "purchase_count,"
            + "purchase_price,"
            + "qualified_count,"
            + "arrival_count,"
            + "gmt_create,"
            + "gmt_modified "
            + "FROM wms_purchase_input_order_item "
            + "WHERE purchase_input_order_id=#{purchaseInputOrderId}")
    @Results({
            @Result(column = "id", property = "id", id = true),
            @Result(column = "purchase_input_order_id", property = "purchaseInputOrderId"),
            @Result(column = "goods_sku_id", property = "goodsSkuId"),
            @Result(column = "purchase_count", property = "purchaseCount"),
            @Result(column = "purchase_price", property = "purchasePrice"),
            @Result(column = "qualified_count", property = "qualifiedCount"),
            @Result(column = "arrival_count", property = "arrivalCount"),
            @Result(column = "gmt_create", property = "gmtCreate"),
            @Result(column = "gmt_modified", property = "gmtModified")
    })
    List<WmsPurchaseInputOrderItem> listByPurchaseInputOrderId(
            @Param("purchaseInputOrderId") Long purchaseInputOrderId);
}
